﻿using MediatR;
using RBAC.Domain;
using RBAC.Domain.Service.Interfae;
using RBACDuYaJun.Api.Appliction.Command.LeaveCommand;

namespace RBACDuYaJun.Api.Appliction.CommandHandlers.LeaveHanders
{
    public class LeaveGetByIdCommandHandler : IRequestHandler<LeaveGetByIdCommand, Leave>
    {
        private readonly ILeaveService _leaveService;
        public LeaveGetByIdCommandHandler(ILeaveService leaveService)
        {
            _leaveService = leaveService;
        }

        public async Task<Leave> Handle(LeaveGetByIdCommand request, CancellationToken cancellationToken)
        {
            return await _leaveService.GetLeaveById(request.leaveId);
        }
    }
}
